﻿using System;
using System.Windows.Forms;

namespace ClipboardSecure
{
    public partial class Center : Form
    {
        public Center()
        {
            InitializeComponent();
            init();
        }

        internal void init()
        {
            ck_report_CheckedChanged(null, null);
        }

        private void ck_report_CheckedChanged(object sender, EventArgs e)
        {
            if (this.InvokeRequired)
            {
                ck_report.BeginInvoke(new Action(() => { 
                    update_ck_report();
                }));
            }
            update_ck_report();
        }
        private void update_ck_report()
        {
            GlobalSettings.report = ck_report.Checked;
            if (ck_report.Checked)
            {
                ck_report_timestamp.Visible =
                ck_report_full.Visible = true;
                ck_report_timestamp.Checked =
                ck_report_full.Checked = false;
                GlobalSettings.Center.record.SetEnable();
                return;
            }
            ck_report_timestamp.Visible =
            ck_report_full.Visible = false;
            GlobalSettings.Center.record.SetDisable();
        }

        private void ck_report_timestamp_CheckedChanged(object sender, EventArgs e)
        {
            GlobalSettings.report_timestamp = ck_report_timestamp.Checked;
        }

        private void ck_report_full_CheckedChanged(object sender, EventArgs e)
        {
            GlobalSettings.report_full = ck_report_full.Checked;

        }

        private void ck_beep_sound_CheckedChanged(object sender, EventArgs e)
        {
            GlobalSettings.beep_sound = ck_beep_sound.Checked;
        }
    }
}
